package com.lhdx.practical.bean;

import com.lhdx.practical.utils.IDGenerator;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * 学生组实体
 */
@Entity
@Table(name="studentgroup")
public class StudentGroup {
    @Id
    private long id;
    /**
     * 小组名称
     */
    private String groupname;
    /**
     * 小组简介
     */
    private String groupintro;
    /**
     * 创始人ID
     */
    private long founderid;
    /**
     * 创始人
     */
    private String foundername;
    /**
     * 小组所在班级
     */
    private long departid;
    /**
     * 年级ID
     */
    private long gradeid;
    /**
     * 小组人数
     */
    private int groupcount;
    /**
     * 小组状态 0小组创建 1提交审核 2审核通过
     */
    private int state;
    /**
     * 创建时间
     */
    private long createtime;

    public StudentGroup(){}

    public StudentGroup(String groupname,String groupintro,Person person){
        this.id = IDGenerator.getID();
        this.groupname = groupname;
        this.groupintro = groupintro;
        this.founderid = person.getId();
        this.foundername = person.getRealname();
        this.departid = person.getDepartid();
        this.gradeid = person.getGradeid();
        this.groupcount = 1;
        this.state = 0;
        this.createtime = new Date().getTime();
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getGroupname() {
        return groupname;
    }

    public void setGroupname(String groupname) {
        this.groupname = groupname;
    }

    public String getGroupintro() {
        return groupintro;
    }

    public void setGroupintro(String groupintro) {
        this.groupintro = groupintro;
    }

    public long getFounderid() {
        return founderid;
    }

    public void setFounderid(long founderid) {
        this.founderid = founderid;
    }

    public String getFoundername() {
        return foundername;
    }

    public void setFoundername(String foundername) {
        this.foundername = foundername;
    }

    public int getGroupcount() {
        return groupcount;
    }

    public void setGroupcount(int groupcount) {
        this.groupcount = groupcount;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public long getCreatetime() {
        return createtime;
    }

    public void setCreatetime(long createtime) {
        this.createtime = createtime;
    }

    public long getDepartid() {
        return departid;
    }

    public void setDepartid(long departid) {
        this.departid = departid;
    }

    public long getGradeid() {
        return gradeid;
    }

    public void setGradeid(long gradeid) {
        this.gradeid = gradeid;
    }
}
